<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<table class="display" id="example">
    <thead>
    <tr>
        <th style="width:2%"><input type="checkbox" id="form-updates7" value="1" onchange="checkAll(this,'salary_overtime_Tax_${organizationId}')"/></th>
        <th style=" width:19%">自定义加班费方案名称</th>
        <th style=" width:14%">每月工作天数</th>
        <th style=" width:13%">平时加班</th>
        <th style=" width:13%">周末加班</th>
        <th style=" width:13%">节假日</th>
        <th style=" width:13%">加班费基数</th>
        <th style=" width:12%">操作</th>
    </tr>
    </thead>
    <tbody>
    <s:if test="#request.salaryOvertimes==null || #request.salaryOvertimes.size==0">
        <tr class="gradeX">
            <td colspan="8">暂无方案数据</td>
        </tr>
    </s:if>
    <s:else>
    <s:iterator var="overtime" value="#request.salaryOvertimes" status="sta">
    <s:if test="#sta.even">
    <tr class="gradeX">
            </s:if>
            <s:else>
    <tr class="gradeC"></s:else>
        <td><input type="checkbox" id="salary_overtime_Tax" name="salary_overtime_Tax_${organizationId}" value="${overtime.id}"/></td>
        <td>${overtime.title}</td>
        <td>${overtime.workDay}</td>
        <td><span style="background:url(${ctx}/images/img/chart_bar_edit.png)"
                  class="icon">&nbsp;</span>${overtime.usuallyOvertime}倍
        </td>
        <td><span style="background:url(${ctx}/images/img/chart_bar_edit.png)"
                  class="icon">&nbsp;</span>${overtime.weekendOvertime}倍
        </td>
        <td><span style="background:url(${ctx}/images/img/chart_bar_edit.png)"
                  class="icon">&nbsp;</span>${overtime.holidaysOvertime}倍
        </td>
        <td><span style="background:url(${ctx}/images/img/chart_bar_edit.png)"
                  class="icon">&nbsp;</span>${overtime.linkedDataType.name}</td>
        <td><a class="button"
               href="#salary/overtime_tax_edit.xhtml?organizationId=${organizationId}&salaryOvertime.id=${overtime.id}&t=<%=new java.util.Date().getTime()%>"><span
                style="background:url(${ctx}/images/img/page_edit.png)"
                class="icon">&nbsp;</span>修改</a></td>
        </s:iterator>
        </s:else>
    </tr>
    </tbody>
</table>
<p>
    <%@ include file="/WEB-INF/pages/common/main_orgtab_pager.jsp" %>
</p>
<div class="tabs side grid_12 leading">
    <div class="clear"></div>
    <div class="grid_12">
        <div class="form-action clearfix">
            <p>
                <a class="button" href="#salary/overtime_tax_edit.xhtml?organizationId=${organizationId}&t=<%=new java.util.Date().getTime()%>"><span
                        style="background:url(${ctx}/images/img/add.png)" class="icon">&nbsp;</span>添加方案</a>
                <a class="button" href="javascript:void(0)" onclick="deleteOvertimeTaxcase();"><span style="background:url(${ctx}/images/img/cancel.png)"
                                                                  class="icon">&nbsp;</span>删除</a>
            </p>
        </div>

    </div>
</div>

<script type="text/javascript">
    //删除个税方案
       function deleteOvertimeTaxcase() {
           var checkIds = new Array();
           $("input[type='checkbox'][name='salary_overtime_Tax_${organizationId}']").each(function() {
               if (this.checked) {
                   checkIds.push(this.value);
               }
           });
           if (checkIds.length == 0) {
               alert('请选择要删除的项');
               return;
           }
           if (confirm("确定要删除选中的数据吗？删除后将无法恢复!")) {
               doDeleteOvertimeTaxcases(checkIds.join(","))
           }
       }

       function doDeleteOvertimeTaxcases(ids) {
           var url = "${ctx}/salary/overtime_tax_remove.xhtml";
           $.ajax(url, {
               type: "POST",
               data:{"overtimeIds":ids},
               dataType:"html",
               cache:false,
               success:function(a) {
                   return pageDownloaded(a, url);
               },
               complete:function() {

               }
           });

       }

</script>